#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>

#define MIN(a, b)	((a) < (b) ? (a) : (b))
#define MAX(a, b)	((a) > (b) ? (a) : (b))
/* #define DEBUG */

static void
print_int_array(const int * const a, const int n)
{
	register int i = 0;

	while (i < n)
		fprintf(stderr, " %d", a[i++]);
	fputc('\n', stderr);
}

static void
swapregs(int * const r1, int * const r2, const int n)
{
	register int i, t;

	if (r1 + n < r2 || r2 + n < r1)
		fprintf(stderr, "swapregs(r1=%p, r2=%p, n=%d): "
				"regions are overlapping\n",
				r1, r2, n);

	for (i = 0; i < n; i++) {
		t = r1[i];
		r1[i] = r2[i];
		r2[i] = t;
	}
}

static int
swapregs_rec_inplace(int *r, const int n, const int len,
		const int * const herp, const int derp)
	/*
	 * Recursively move a sequence of ints of length 'len' to the right
	 * of buffer 'r' with total length of 'n'
	 *
	 * 	len <= n
	 */
{
	if (n == len || len == 0)
		return 0;

#ifdef DEBUG
	fprintf(stderr, "s_r_i(*r=%d, n=%d, len=%d) :",
			*r, n, len);
	print_int_array(herp, derp);
#endif

	if (len < n - len) {
		swapregs(r, r + len, len);
		return swapregs_rec_inplace(r + len, n - len, len, herp, derp);
	} else if (len * 2 == n) {
		swapregs(r, r + len, len);
#ifdef DEBUG
		fprintf(stderr, "s_r_i(*r=%d, n=%d, len=%d) len * 2 == n :",
				*r, n, len);
		print_int_array(herp, derp);
#endif
		return 0;
	} else {
		/* (len > n - len) */
#define t	(n - len) /* ergh.. */
		swapregs(r + len, r + len - t, t);
		return swapregs_rec_inplace(r, n - t, len - t, herp, derp);
#undef t
	}
}

static int
move(int *a, const int n, int s, int l, int m)
{
	int mid;

	if (m <= s) {
		//mid = s;
		swapregs_rec_inplace(a + m, s + l - m, s - m, a, n);
	} else {
		//mid = s + l;
		swapregs_rec_inplace(a + s, m - s, l, a, n);
	}

	return 0;
}

int
main(int argc, char **argv)
{
	static int a[100000];
	int n, s, l, m;
	int i;

	(void) scanf("%d", &n);
	for (i = 0; i < n; i++)
		(void) scanf("%d", &a[i]);
	(void) scanf("%d%d%d", &s, &l, &m);

	(void) move(a, n, s, l, m);

	for (i = 0; i < n; i++)
		(void) printf("%d ", a[i]);
	(void) fputc('\n', stdout);

	return 0;
}
// vim:foldmethod=marker:
